<!-- 潜在震源区分布-面 -->
<template>
    <el-drawer v-model="addDrawer" size="50%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
        <template #title>
            <h2><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></h2>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading" v-if="isShowSave">保存</el-button>
            <el-button type="primary" @click="closeDrawer">关闭</el-button>
        </template>
        <template #default>
            <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="190px"
                v-loading="drawerLoading">
                <el-row justify="space-between">
                    <el-form-item label="省">
                        <el-input v-model="form.province" clearable disabled></el-input>
                    </el-form-item>
                    <el-form-item label="市">
                        <el-input v-model="form.city" clearable disabled></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="区/县">
                        <el-input v-model="form.county" clearable disabled></el-input>
                    </el-form-item>
                    <el-form-item label="潜在震源区编号" prop="id">
                        <el-input v-model="form.id" placeholder="请输入潜在震源区编号" clearable maxlength="17"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="潜源名称" prop="name">
                        <el-input v-model="form.name" placeholder="请输入潜源名称" clearable maxlength="40"></el-input>
                    </el-form-item>
                    <el-form-item label="震级上限[M]" prop="mu">
                        <el-input v-model="form.mu" placeholder="请输入震级上限[M]" clearable maxlength="8"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="第一破裂方向" prop="direction1">
                        <el-input-number v-model="form.direction1" placeholder="范围0-359" :min="0" :max="359"></el-input-number>
                    </el-form-item>
                    <el-form-item label="第一破裂方向概率" prop="p1">
                        <el-input-number v-model="form.p1" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="第二破裂方向" prop="direction2">
                        <el-input-number v-model="form.direction2" placeholder="范围0-359" :min="0" :max="359"></el-input-number>
                    </el-form-item>
                    <el-form-item label="第二破裂方向概率" prop="p2">
                        <el-input-number v-model="form.p2" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="4.0 – 5.4级概率" prop="f1">
                        <el-input-number v-model="form.f1" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                    <el-form-item label="5.5 – 5.9级概率" prop="f2">
                        <el-input-number v-model="form.f2" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="6.0 – 6.4级概率" prop="f3">
                        <el-input-number v-model="form.f3" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                    <el-form-item label="6.5 – 6.9级概率" prop="f4">
                        <el-input-number v-model="form.f4" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="7.0 – 7.4级概率" prop="f5">
                        <el-input-number v-model="form.f5" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                    <el-form-item label="7.5级以上概率" prop="f6">
                        <el-input-number v-model="form.f6" placeholder="范围0-1" :min="0" :max="1"></el-input-number>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="备注" prop="commentInfo" style="width:100%">
                        <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 6, maxRows: 12 }"
                            type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
                    </el-form-item>
                </el-row>
            </el-form>
        </template>
    </el-drawer>
</template>
<script setup>
// 引入基础方法
import useSpatialData from '@/hooks/useSpatialData';
// 引入表单验证规则
import { eightDouble, fourInt } from '@/utils/validate';
// 获取数据字典值
import { getDict } from '@/api/system/dict'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, isShowSave } = useSpatialData();
// 表单验证规则
const formRules = {
    id: [{ required: true, message: '请输入潜在震源区编号！', trigger: 'blur' }],
    name: [{ required: true, message: '请输入潜源名称', trigger: 'blur' }],
    mu: [eightDouble],
    direction1: [fourInt],
    p1: [eightDouble],
    direction2: [fourInt],
    p2: [eightDouble],
    f1: [eightDouble],
    f2: [eightDouble],
    f3: [eightDouble],
    f4: [eightDouble],
    f5: [eightDouble],
    f6: [eightDouble],
}
</script>
<style lang="scss" scoped>
.el-input-number {
    width: 210px;
}
</style>